﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Xml;
using System.IO;

public class CreatXml : MonoBehaviour 
{
    private void Awake()
    {
        generixml();
    }
    public void generixml()
    {

        XmlDocument doc = new XmlDocument();
        XmlDeclaration decla = doc.CreateXmlDeclaration("1.0", "utf-8", null);
        doc.AppendChild(decla);
        XmlElement root = doc.CreateElement("task");
        doc.AppendChild(root);
        XmlElement task1 = doc.CreateElement("conditionID");
        task1.InnerText = "消灭死莱姆";
        root.AppendChild(task1);
        XmlElement amount = doc.CreateElement("conditionTargetAmount");
        amount.InnerText = "5";
        root.AppendChild(amount);
        XmlElement rid = doc.CreateElement("rewardID");
        rid.InnerText = "给你一个大大的拥抱";
        root.AppendChild(rid);
        XmlElement ramount = doc.CreateElement("rewardAmount");
        ramount.InnerText = "5次";
        root.AppendChild(ramount);
        doc.Save(Application.dataPath + "/TestTask/Task.xml");
        Debug.Log("ok");



    }
}
